﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="_UserManage.aspx.cs" Inherits="UserManage" Title="无标题页" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <link type="text/css" rel="Stylesheet" href="CSS/UserManage.css" />
    <div id="UserManagePage" class="IsNeedLogin" runat="server">
        <div class="UserManagePage">
            <div id="UserManageLeft" class="UserManageLeft">
                <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="No"
                    DataSourceID="RiskManage" DefaultMode="Insert" CssClass="InsertArea">                    
                    <Fields>
                        <asp:BoundField DataField="No" HeaderText="No" InsertVisible="False" ReadOnly="True"
                            SortExpression="No" />
                        <asp:BoundField DataField="EmpID" HeaderText="工号" SortExpression="EmpID" />
                        <asp:BoundField DataField="EmpName" HeaderText="姓名" SortExpression="EmpName" />
                        <asp:BoundField DataField="EmpPassword" HeaderText="密码" SortExpression="EmpPassword" />
                        <asp:BoundField DataField="GroupName" HeaderText="处室" SortExpression="GroupName" />
                        <asp:CheckBoxField DataField="IsAdmin" HeaderText="管理员" SortExpression="IsAdmin" />
                        <asp:CommandField ShowInsertButton="True" />
                    </Fields>
                    <InsertRowStyle CssClass="InsertRowStatus" />
                </asp:DetailsView>
            </div>
            <div id="UserManageRight" class="UserManageRight">
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                    AutoGenerateColumns="False" DataKeyNames="No" DataSourceID="RiskManage" 
                    PageSize="20">
                    <Columns>
                        <asp:BoundField DataField="No" HeaderText="编号" InsertVisible="False" ReadOnly="True"
                            SortExpression="No" />
                        <asp:BoundField DataField="EmpID" HeaderText="工号" SortExpression="EmpID" />
                        <asp:BoundField DataField="EmpName" HeaderText="姓名" SortExpression="EmpName" />
                        <asp:BoundField DataField="EmpPassword" HeaderText="密码" SortExpression="EmpPassword" />
                        <asp:BoundField DataField="GroupName" HeaderText="处室" SortExpression="GroupName" />
                        <asp:CheckBoxField DataField="IsAdmin" HeaderText="管理员" SortExpression="IsAdmin" />
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                    </Columns>
                    <PagerStyle CssClass="Pager" />
                    <EditRowStyle Wrap="False" CssClass="EditStatus" />
                </asp:GridView>
            </div>
            <asp:AccessDataSource ID="RiskManage" runat="server" DataFile="~/App_Data/RiskManage.mdb"
                DeleteCommand="DELETE FROM [UserList] WHERE [No] = ?" InsertCommand="INSERT INTO [UserList] ([EmpID], [EmpName], [EmpPassword], [GroupName], [IsAdmin]) VALUES (?, ?, ?, ?, ?)"
                SelectCommand="SELECT [No], [EmpID], [EmpName], [EmpPassword], [GroupName], [IsAdmin] FROM [UserList] ORDER BY [EmpID]"
                UpdateCommand="UPDATE [UserList] SET [EmpID] = ?, [EmpName] = ?, [EmpPassword] = ?, [GroupName] = ?, [IsAdmin] = ? WHERE [No] = ?">
                <DeleteParameters>
                    <asp:Parameter Name="No" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="EmpID" Type="String" />
                    <asp:Parameter Name="EmpName" Type="String" />
                    <asp:Parameter Name="EmpPassword" Type="String" />
                    <asp:Parameter Name="GroupName" Type="String" />
                    <asp:Parameter Name="IsAdmin" Type="Boolean" />
                    <asp:Parameter Name="No" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <%--<asp:Parameter Name="No" Type="Int32" />--%>
                    <asp:Parameter Name="EmpID" Type="String" />
                    <asp:Parameter Name="EmpName" Type="String" />
                    <asp:Parameter Name="EmpPassword" Type="String" />
                    <asp:Parameter Name="GroupName" Type="String" />
                    <asp:Parameter Name="IsAdmin" Type="Boolean" />
                </InsertParameters>
            </asp:AccessDataSource>
        </div>
    </div>
</asp:Content>
